from pydantic import BaseModel
from typing import Optional


# 存储用户曲线图信息恢复表用
class Save_Userproj_Curve_Data(BaseModel):
    User_ID: str
    Proj_ID: str
    Curve_Data: str


# 返回数据时用
class Return_Data(BaseModel):
    User_ID: str
    Proj_ID: str


# 计算表格数据恢复用
class Userproj_Oilstimeval(BaseModel):
    User_ID: str
    Proj_ID: str
    Data: str
    inputdata: str
    output: str

class oilprodcost(BaseModel):
    DvpUnit_Name: str
    Year: str
    Oil_OprCost: float
    FuelCost: float
    Power_Cost: float
    FluidDispose_Cost: float
    OilDisplaceAgent_Cost: float
    NGLRecovery_Cost: float
    Transp_Cost: float
    WellTest_Cost: float
    Other_Cost: float
    Depre_Cost: float
    Remark: str


class oilsalecost_ratio(BaseModel):
    DvpUnit_Name: str
    Year: str
    OilSale_TotalTaxRatio: float
    AddedValue_TaxRatio: float
    Resource_TaxRatio: float
    EduAdd_TaxRatio: float
    CityDvpAdd_TaxRate: float
    Income_TaxRate: float
    ManageCost_Ratio: float
    Remark: str


# 计算操作吨油成本
class Oil_Opr_Cost(BaseModel):
    fuelcost: float
    power_cost: float
    fluiddispose_cost: float
    oildisplaceagent_cost: float
    nglrecovery_cost: float
    transp_cost: float
    welltest_cost: float
    other_cost: float
    depre_cost: float


# 计算销售税费率
class Oil_Sale_TotalTax(BaseModel):
    addedvalue_taxratio: float
    resource_taxratio: float
    eduadd_taxratio: float
    citydvpadd_taxrate: float
    income_taxrate: float
    managecost_ratio: float


class Output_Page_Data(BaseModel):
    dvpunit_name: str
    year: int
    validperiod: int
    oilprice: float
    stimcost: float  # 作业成本/费用
    increoil: float  # 平均措施增油
    oiloprcost: float  # 操作吨油成本
    oilcommodityratio: float  # 原油商品率
    totaltaxratio: float  # 平均销售税费
    discount: float  # 资金贴现率


class Save_table_data(BaseModel):  # 存储表格数据
    DvpUnit_Name: str
    Year: str
    StimType_Name: str
    Stim_WellNumber_Valid: int
    Stim_WellValidRatio: float
    Stim_ValidPeriod_Average: int
    Stim_IncreOil_Average: float
    StimCost_Average: float
    Oil_OprCost: float
    Oil_Price: float
    StimOil_CommodityRatio: float
    OilSale_TotalTaxRatio: float
    Money_Discount: float
    Remark: str
    StimOil_WellOprCost_Average: float
    StimOil_Total_TaxRatio_Average: float
    StimOil_Gross_SalesIncome_Average: float
    StimOil_Static_Gains_Average: float
    StimOil_NPV_Average: float
    StimOil_ROI: float
    StimOil_NPVR: float
    StimOil_FIRR: float
    Stim_IncreOil_Critical_Average: float
    StimOil_Price_Critical: float


class Save_Data_Private(BaseModel):
    User_ID = str
    Proj_ID = str
    DvpUnit_Name: str
    Year: str
    StimType_Name: str
    Stim_WellNumber_Valid: int
    Stim_WellValidRatio: float
    Stim_ValidPeriod_Average: int
    Stim_IncreOil_Average: float
    StimCost_Average: float
    Oil_OprCost: float
    Oil_Price: float
    StimOil_CommodityRatio: float
    OilSale_TotalTaxRatio: float
    Money_Discount: float
    Remark: str
    StimOil_WellOprCost_Average: float
    StimOil_Total_TaxRatio_Average: float
    StimOil_Gross_SalesIncome_Average: float
    StimOil_Static_Gains_Average: float
    StimOil_NPV_Average: float
    StimOil_ROI: float
    StimOil_NPVR: float
    StimOil_FIRR: float
    Stim_IncreOil_Critical_Average: float
    StimOil_Price_Critical: float


# 存储界面数据
class User_Proj_page(BaseModel):
    User_ID: str  # 用户id
    Proj_ID: str  # 工程id
    Ramake: str  # 备注


# 用户工程单元经济评价计算功能输入数据表
class Input_Data(BaseModel):
    User_ID: str
    Proj_ID: str
    DvpUnit_Name: str
    Year: str
    StimType_Name: str
    Stim_WellNumber_Valid: int
    Stim_WellValidRatio: float
    Stim_ValidPeriod_Average: int
    Stim_IncreOil_Average: float
    StimCost_Average: float
    Oil_OprCost: float
    Oil_Price: float
    StimOil_CommodityRatio: float
    OilSale_TotalTaxRatio: float
    Money_Discount: float
    Remark: str


# 管理员界面数据
class Admin_Page(BaseModel):
    User_ID: str
    Proj_ID: str
    Page_Data: str
